<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=\, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>zyx</title>
</head>
<body>
    <script>
    /****************************简单类型***/
    //string
    var str = '字符串';
    console.log(typeof str); //string
    //number
    var num = 20;
    console.log(typeof num);  //number
    // bool
    var bool = true;
    console.log(typeof bool); //boolean
    //undefined
    var a;
    console.log(typeof a); //undefined
    //空
    var b = null;
    console.log(typeof b); //null | object

    /**************复杂数据类型**********************/
    //对象

    var obj = {
        name:'老周',
        sayHi:function () {
            console.log('hi');
        }
    }
    console.log(typeof obj); //object
    obj.sayHi();


    //数组 
    var arr = [1,24,30];
    console.log((typeof arr));  //object

    //date 时间对象
    var date = new Date();
    console.log(typeof date); //object

    var fun = function(){

    }
    console.log(typeof fun); //function
    //结论 : 复杂数据类型 通过操作符 typeof 操作得到的类型为object;
    //但是function 这个复杂数据类型除外 它得到的类型为function


    //简单数据类型 的包装
    var str1 = str.substr(1);
    console.log(str1);
    </script>
</body>
</html>